home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt40s5.arc
/
SENDMODE.MOD
< prev
next >
Wrap
Text File
|
1987-05-04
|
5KB
|
116 lines
(*----------------------------------------------------------------------*)
(* Send_Modem_Command --- Send command to modem *)
(*----------------------------------------------------------------------*)
PROCEDURE Send_Modem_Command( Modem_Text : AnyStr );
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Send_Modem_Command *)
(* *)
(* Purpose: Sends command to modem *)
(* *)
(* Calling Sequence: *)
(* *)
(* Send_Modem_Command( Modem_Text : AnyStr ); *)
(* *)
(* Modem_Text --- text of command to send to modem *)
(* *)
(* Calls: *)
(* *)
(* Async_Send *)
(* Async_Receive *)
(* *)
(* Remarks: *)
(* *)
(* If the string to be sent has not "Wait For" markers, then *)
(* it is sent in its entirety in one call here. If there ARE *)
(* "Wait For" characters, then the flag WaitString_Mode is set *)
(* TRUE, Script_When_Text is set to the character to be found, *)
(* and Script_When_Reply_Text is set to the remainder of the *)
(* function key string. This allows the terminal emulation to *)
(* properly process any received characters while PibTerm is *)
(* waiting for the selected string to appear. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
I: INTEGER;
L: INTEGER;
Ch: CHAR;
MO_Char: CHAR;
Done: BOOLEAN;
BEGIN (* Send_Modem_Command *)
L := LENGTH( Modem_Text );
I := 1;
Done := FALSE;
WHILE( I <= L ) AND ( NOT Done ) DO
BEGIN
MO_Char := Modem_Text[I];
IF MO_Char = FK_CR THEN
Async_Send( CHR( CR ) )
ELSE IF MO_Char = FK_Delay THEN
DELAY( One_Second_Delay )
ELSE IF MO_Char = FK_Wait_For THEN
BEGIN (* Wait For *)
I := SUCC( I );
IF ( I <= L ) THEN
BEGIN
WITH Script_Wait_List[1] DO
BEGIN
NEW( Wait_Text );
Wait_Text^ := Modem_Text[I];
NEW( Wait_Reply );
I := SUCC( I );
IF ( I <= L ) THEN
Wait_Reply^ := COPY( Modem_Text, I, SUCC( L - I ) )
ELSE
Wait_Reply^[0] := #0;
Script_Wait_Check_Length := 1;
END;
Script_Wait_Count := 1;
WaitString_Mode := TRUE;
Really_Wait_String := TRUE;
Script_Wait_Time := Script_Default_Wait_Time;
IF ( Script_Wait_Time <= 0 ) THEN
Script_Wait_Time := 60;
Script_Wait_Failure := 0;
Done := TRUE;
Script_Wait_Start := TimeOfDay;
END;
END
ELSE IF MO_Char = FK_Ctrl_Mark THEN
BEGIN
IF ( ( I + 2 ) <= L ) THEN
IF ( Modem_Text[ SUCC( I ) ] = '''' ) THEN
I := I + 2;
Async_Send( Modem_Text[I] );
END
ELSE
BEGIN
Async_Send( Modem_Text[I] );
IF ( Modem_Command_Delay > 0 )
THEN DELAY( Modem_Command_Delay );
END;
I := SUCC( I );
END;
END (* Send_Modem_Command *);